package com.dankegongyu.lib.common.widget.dropdown;

import android.view.View;

/**
 * @author WuPuquan
 * @version 1.0
 * @since 2017/10/25 09:49
 */

public class DropDownMenuContentItem {

    private View contentView;
    private DropDownMenuContentItemInterface dropDownMenuContentItemInterface;

    public DropDownMenuContentItem(View contentView, DropDownMenuContentItemInterface dropDownMenuContentItemInterface) {
        if (contentView == null) {
            throw new IllegalArgumentException("contentView cannot be null");
        }
        if (dropDownMenuContentItemInterface == null) {
            throw new IllegalArgumentException("dropDownMenuContentItemInterface cannot be null");
        }
        this.contentView = contentView;
        this.dropDownMenuContentItemInterface = dropDownMenuContentItemInterface;
    }

    public View getContentView() {
        return contentView;
    }

    public void setContentView(View contentView) {
        this.contentView = contentView;
    }

    public DropDownMenuContentItemInterface getDropDownMenuContentItemInterface() {
        return dropDownMenuContentItemInterface;
    }

    public void setDropDownMenuContentItemInterface(DropDownMenuContentItemInterface dropDownMenuContentItemInterface) {
        this.dropDownMenuContentItemInterface = dropDownMenuContentItemInterface;
    }

    public void showState(boolean selected) {
        if (dropDownMenuContentItemInterface != null) {
            dropDownMenuContentItemInterface.showState(selected);
        }
    }

    public void reset() {
        if (dropDownMenuContentItemInterface != null) {
            dropDownMenuContentItemInterface.reset();
        }
    }

    public interface DropDownMenuContentItemInterface{
        void showState(boolean selected);
        void reset();
    }
}
